package A0507;

public class Main {
    int lastIndexOf(String s,char ch){
        for(int i=s.length()-1;i>=0;i--){
            if(s.charAt(i)==ch){
                return i;
            }
        }
        return -1;
    }

    public static void fun(String s){

    }
    public static void main(String[] args) {
//        System.out.println("hello world");
        String s1 = "s1";
        String s2 = null;//空，对象的空
        String s3 = "";
        s1 = "s2";
        int len = s1.length();
        System.out.println(len);
        String s4 = new String("abc");
        System.out.println(s4);
        String s5 = new String();//空参构造
        char[] chs = {'a', 'b', 'd'};
        String s6 = new String(chs);
        System.out.println(s6);
        byte[] b1 = {97,98,101};
        String s7 = new String(b1);
        System.out.println(s7);
        System.out.println(s6+s7);
        String s8 = "hello world";
        for(int i=0;i<s8.length();i++){
            char ch = s8.charAt(i);
        }
        System.out.println("apple".startsWith("app"));
        int a = 123;
        System.out.println(String.valueOf(a));
        char[] chs1 = s8.toCharArray();
        String s9 = "192.168.1.1";
        String[] ss = s9.split("\\.");
        String s10 = String.valueOf(chs1);
        System.out.println(s10);
        s10 = s10.replace('l','L');
        System.out.println(s10);
        System.out.println("apple".endsWith("le"));
        System.out.println("apple".contains("pp"));
//        String.valueOf();toS
        StringBuffer sb = new StringBuffer("apple");
        System.out.println(sb);
        System.out.println(sb.toString());
        fun(sb.toString());
    }
}
